package com.rmb.util;

import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
 * @version 1.0
 * @Author a
 * @Date 2021/1/8 19:40
 */
public class UpdateExcel {
    public void readExcel(String aa){
        try {
            //创建输入流获取文件地址
            FileInputStream fil = new FileInputStream(aa);
            //获取输入流的工作普
            HSSFWorkbook wb = new HSSFWorkbook(fil);
            //在工作普中获取工作表 根据下表获取
            HSSFSheet sheetAt = wb.getSheetAt(0);
            //第一行特殊，单独获取
            HSSFRow row = sheetAt.getRow(0);
            String a1 = row.getCell(0).getStringCellValue();
            String a2 = row.getCell(1).getStringCellValue();
            String a3 = row.getCell(2).getStringCellValue();
            String a4 = row.getCell(3).getStringCellValue();
            String a5 = row.getCell(4).getStringCellValue();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
